package cn.liuhong.controller;

import cn.liuhong.entity.Users;
import cn.liuhong.entity.UsersExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.liuhong.entity.Emp;
import cn.liuhong.service.EmpService;

import java.util.List;

@Controller
public class EmpController {
    
	@Autowired
	private EmpService empService;
	
	@RequestMapping("/getEmp")
	@ResponseBody
	public Emp getEmp() {
		return empService.getEmp(2);
	}
	@RequestMapping("/getUsers")
	@ResponseBody
	public List<Users> getUsers() {
		UsersExample usersExample = new UsersExample();
		UsersExample.Criteria criteria = usersExample.createCriteria();
		criteria.andNameLike("%张%");
		return empService.getUsers(usersExample);
	}
}
